using System;
using System.Xml.Schema;
using System.Xml.Serialization;
using flickr.api.communication;

namespace flickr.api
{
    [Serializable]
    public class GroupInfo : FlickrObject
    {
        public GroupInfo():base(){}
        public GroupInfo(FlickrConnection connection) : base(connection){}
        
        [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)]
        public string GroupId;
    
        [XmlAttribute("url", Form=XmlSchemaForm.Unqualified)]
        public string Url;

        [XmlElement("groupname", Form=XmlSchemaForm.Unqualified)]
        public string GroupName;

        [XmlElement("members", Form=XmlSchemaForm.Unqualified)]
        public long Members;
	
        [XmlElement("online", Form=XmlSchemaForm.Unqualified)]
        public int NumberOnline;
	
        [XmlElement("privacy", Form=XmlSchemaForm.Unqualified)]
        public PoolPrivacy Privacy;
	
        [XmlElement("chatnsid", Form=XmlSchemaForm.Unqualified)]
        public string ChatId;
	
        [XmlElement("chatcount", Form=XmlSchemaForm.Unqualified)]
        public int NumberInChat;

        public static implicit operator Group( GroupInfo gi )	
        {
            Group g = new Group(Flickr.Connection);
            g.GroupId = gi.GroupId;
            g.GroupName = gi.GroupName;
            g.Members = gi.Members;
            g.NumberOnline = gi.NumberOnline;
            g.ChatId = gi.ChatId;
            g.NumberInChat = gi.NumberInChat;

            return g;
        }

        public static explicit operator GroupInfo( Group g )	
        {
            GroupInfo gi = new GroupInfo(Flickr.Connection);
            gi.GroupId = g.GroupId;
            gi.GroupName = g.GroupName;
            gi.Members = g.Members;
            gi.NumberOnline = g.NumberOnline;
            gi.NumberInChat = g.NumberInChat;
            gi.ChatId = g.ChatId;

            return gi;
        }
    }
}